<template>
	<u-modal v-model="show" :show-cancel-button="true" confirm-text="升级" title="发现新版本" @cancel="cancel"
		@confirm="confirm">
		<u-row>
			<u-col span="12">
				<u-row style="width: 100%;">
					<u-col span="6" align="top" style="padding: 30rpx 0 20rpx 20rpx;">
						<text>选择类别</text>
					</u-col>
					<u-col span="6" align="bottom" style="padding: 30rpx 20rpx 20rpx 0;" @click="showPop(0)">
						取消
					</u-col>
				</u-row>
			</u-col>
			<u-col span="12">
				<swiper @change="changesw" style="width: 100%;height: 160rpx;">
					<template v-for="(item, index) in PubCateCount">
						<swiper-item>
							<u-grid :col="4" :border="false">
								<template v-for="(chitem, chindex) in PubCateList.slice(4*index,4*(index+1))">
									<u-grid-item bg-color="transparent" @click="ToPub(chitem.cate)">
										<u-icon :name="chitem.iconame" :size="60"></u-icon>
										<view class="u-font-12">{{chitem.txt}}</view>
									</u-grid-item>
								</template>
							</u-grid>
						</swiper-item>
					</template>
				</swiper>
			</u-col>
		</u-row>
	</u-modal>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				PubCateCount: 0,
				PubCateList: [{
					cate: "workerPub",
					iconame: "/static/topnav/pubNav/set-house.png",
					txt: "装修工单"
				}, {
					cate: "proprietorPub",
					iconame: "/static/topnav/pubNav/proprietor.png",
					txt: "业主发单"
				}, {
					cate: "outhousePub",
					iconame: "/static/topnav/pubNav/out-house.png",
					txt: "房源出租"
				}, {
					cate: "newsPub",
					iconame: "/static/topnav/pubNav/pub-news.png",
					txt: "生活动态"
				}]
			}
		},
		async onReady() {
			var _pubCateCount = this.PubCateList.length;
			this.PubCateCount = Math.floor(_pubCateCount / 4) + (_pubCateCount % 4 == 0 ? 0 : 1);
		},
		methods: {
			showPop(_val) {
				this.popupIsShow = _val == 1 ? true : false;
			},
			cancel() {
				this.closeModal();
			},
			confirm() {
				this.closeModal();
			},
			closeModal() {
				uni.navigateBack();
			}
		}
	}
</script>

<style>

</style>
